﻿<!doctype html>

<html>

<head>
    <meta charset="utf-8">
    <title>实名认证</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <link rel="stylesheet" href="/lobsteruiframe/weui/css/weui.css" />
    <link rel="stylesheet" href="/lobsteruiframe/weui/css/weuix.css" />
    <link href="/customer/css/blue.css" rel="stylesheet" />
    <script src="/lobsteruiframe/weui/js/zepto.min.js"></script>
    <script src="/lobsteruiframe/weui/js/zepto.weui.js"></script>
    <script src="/lobsteruiframe/weui/js/php.js"></script>
    <script src="/jslib/template-web.js"></script>
    <script src="/jslib/lobster.js"></script>
    <style type="text/css">
        .tipsTitile {
            color: #CCCCCC;
            padding: 16px;
            font-size: 17px;
        }
    </style>
</head>

<body ontouchstart>
    <div class="maincontent" id="maincontent">
        <div class='pageContent'>
            <div class="tipsTitile bg-gray">温馨提示：在进行后续操作之前，需要对您进行实名认证，请确保是本人操作</div>
        </div>
        <div class="page-bd-15 page-hd">
            <a href="javascript:;" class="weui-btn weui-btn_primary" id="face">人脸识别认证</a>
            <a href="javascript:;" class="weui-btn weui-btn_primary" id="idcard">上传身份证认证</a>
            <a href="javascript:;" class="weui-btn  b-green f-green" id="noverify">暂不认证</a>
        </div>
        </div>
</body>
</html>

<script>

    lobsterh5.main({
        data: {
            patientId: -1,
            patientInfo: {},
        },
        pageload() {
            var self = this;
            self.data.patientId = lobsterh5.GetUrlParam("patientId") || 0;
            self.bindEvent();
            self.getdata();
        },
        bindEvent() {
            var self = this;
            $(document).on("click", "#face", function () { //人脸识别
                $.toast("敬请期待");
            });
            $(document).on("click", "#idcard", function () { //身份证验证
                if (self.data.patientInfo && self.data.patientInfo.DetectFlag == 0) {
                    location.href = "idcard.html?patientId=" + self.data.patientId;
                }
            });
            $(document).on("click", "#noverify", function () { //暂不验证
                location.replace("patient.html");
            });
        },
        getdata() {
            var self = this;

            lobsterh5.GET("/admin/v1/CPatient/GetPatientByPId", { patientId: self.data.patientId}).then(res => {
                console.log(res);
                self.data.patientInfo = res.patientInfo;

                var detectFlag = self.data.patientInfo.DetectFlag;
                if (detectFlag == 1 || detectFlag == 3) {
                    $("#idcard").html("上传身份证认证(已认证)");
                    $("#idcard").removeClass("weui-btn_primary").addClass("weui-btn_disabled").addClass("bg-gray").addClass("f-gray");
                }
                if (detectFlag == 3) {
                    $("#face").html("人脸识别认证(已认证)");
                    $("#face").removeClass("weui-btn_primary").addClass("weui-btn_disabled").addClass("bg-gray").addClass("f-gray");
                }

            }).catch(res => {
                self.data.patientInfo = {};
                console.log(res);
                $.toast(res.msg || "获取就诊人失败", "forbidden");
            });
        }
    });
</script>